{php $CSS = array('extend');}
{template 'header'}
{if $itemid}
<div class="m">	
	<div class="left_box">	
		<div class="pos">当前位置: <a href="{$MODULE[1][linkurl]}">首页</a> &raquo; {$title}</div>
		{if $page == 2}
		<div style="margin:20px;">
			<div class="submit_success">
			提交成功，感谢您的参与！
			</div>
		</div>
		{else}
		<div style="margin:5px 15px 5px 15px;line-height:36px;" class="t_c px14"><strong>{$title}</strong></div>
		<div class="info f_gray"><span class="f_r">浏览：<span class="f_red">{$hits}</span>&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:window.location.reload();">[刷新]</a>&nbsp;<script type="text/javascript">addFav('[收藏]');</script></span>添加时间：{$adddate}&nbsp;&nbsp;&nbsp;<img src="{DT_STATIC}file/image/process_{get_process($fromtime, $totime)}.gif" align="absmiddle" alt="有效期：{$fromdate} 至 {$todate}"/></div>
		{if $content}<div class="pd20 lh18 px13">{$content}</div>{else}<div class="b10"></div>{/if}
		{if $lists}		
		<form action="{$url}index.php" method="post" onsubmit="return check();">		
		<input type="hidden" name="itemid" value="{$itemid}"/>
		<input type="hidden" name="item" value="{$item}"/>
		<div class="{if $display}survey{else}form{/if}">
		<table width="100%" cellpadding="10" cellspacing="0">
		{loop $lists $k $v}
		<tr>
		<td class="f_1"><span class="f_0">{$k+1}. </span>{$v[name]}{if $v[min]} <span class="f_red">*</span>{/if}</td>
		{if $display}
		</tr>
		<tr>
		{/if}
		<td class="f_2">
		{if $v[type] == 0}
		<input type="text" name="a[{$v[qid]}]" id="q_{$v[qid]}"{$v[extend]}/> <span id="dq_{$v[qid]}" class="f_red"></span>
		{elseif $v[type] == 1}
		<textarea name="a[{$v[qid]}]" id="q_{$v[qid]}"{$v[extend]}></textarea><br/><span id="dq_{$v[qid]}" class="f_red"></span>
		{elseif $v[type] == 2}
		<select name="a[{$v[qid]}]" id="q_{$v[qid]}"{$v[extend]}>
		<option value="">请选择</option>
		{loop $v[option] $kk $vv}
		<option value="{$vv[name]}"{if $vv[on]} selected{/if}>{$vv[name]}</option>
		{/loop}
		</select> <span id="dq_{$v[qid]}" class="f_red"></span>
		{elseif $v[type] == 3}
		<ul id="q_{$v[qid]}"{$v[extend]}>
		{loop $v[option] $kk $vv}
		<li class="f_3"><input type="checkbox" name="a[{$v[qid]}][]" value="{$vv[name]}" id="q_{$v[qid]}_{$kk}" {if $vv[on]} checked{/if}/><label for="q_{$v[qid]}_{$kk}">{$vv[name]}{if $vv[name] == '其他'} <input type="text" name="o[{$v[qid]}]" id="other_{$v[qid]}" size="10" onfocus="Dd('q_{$v[qid]}_{$kk}').checked=true;"/>{/if}</label>		
		</li>
		{/loop}
		</ul><br class="c_b"/><span id="dq_{$v[qid]}" class="f_red"></span>
		{elseif $v[type] == 4}
		<ul id="q_{$v[qid]}"{$v[extend]}>
		{loop $v[option] $kk $vv}
		<li class="f_3"><input type="radio" name="a[{$v[qid]}]" value="{$vv[name]}" id="q_{$v[qid]}_{$kk}" {if $vv[on]} checked{/if}/><label for="q_{$v[qid]}_{$kk}">{$vv[name]}{if $vv[name] == '其他'} <input type="text" name="o[{$v[qid]}]" id="other_{$v[qid]}" size="10" onfocus="Dd('q_{$v[qid]}_{$kk}').checked=true;"/>{/if}</label></li>
		{/loop}
		</ul><br class="c_b"/><span id="dq_{$v[qid]}" class="f_red"></span>
		{/if}		
		</td>
		</tr>
		{/loop}
		</table>
		</div>
		<table width="100%" cellpadding="10" cellspacing="0">
		{if $verify == 1}
		<tr>
		<td align="right"><span class="f_red">*</span> 验证码&nbsp;&nbsp;</td>
		<td>{template 'captcha', 'chip'} <span id="dcaptcha" class="f_red"></span></td>
		</tr>
		{/if}
		{if $verify == 2}
		<tr>
		<td align="right"><span class="f_red">*</span> 验证问题&nbsp;&nbsp;</td>
		<td>{template 'question', 'chip'} <span id="danswer" class="f_red"></span></td>
		</tr>
		{/if}
		<tr>
		<td width="200"></td>
		<td><input type="submit" name="submit" value=" 提 交 " class="submit_btn"/></td>
		</tr>
		</table>
		</form>
		<script type="text/javascript">
		function check() {
			var l;
			var f;
			{loop $lists $k $v}
			{if $v[min]}
			f = 'q_{$v[qid]}';
			{if $v[type] == 0 || $v[type] == 1}
			l = Dd(f).value.length;
			if(l < {$v[min]}) {
				Dmsg('{$v[name]}最少{$v[min]}字', f);
				return false;
			}
			{if $v[max]}
			if(l > {$v[max]}) {
				Dmsg('{$v[name]}最多{$v[max]}字', f);
				return false;
			}
			{/if}
			{elseif $v[type] == 2}
			l = Dd(f).value.length;
			if(l == 0) {
				Dmsg('请选择{$v[name]}', f);
				return false;
			}
			{elseif $v[type] == 3}
			l = checked_count(f);
			if(l < {$v[min]}) {
				Dmsg('{$v[name]}最少选择{$v[min]}项', f, 1);
				return false;
			}
			{if $v[max]}
			if(l > {$v[max]}) {
				Dmsg('{$v[name]}最多选择{$v[max]}项', f, 1);
				return false;
			}
			{/if}
			{elseif $v[type] == 4}
			l = checked_count(f);
			if(l == 0) {
				Dmsg('请选择{$v[name]}', f, 1);
				return false;
			}
			{/if}
			{/if}
			{/loop}
			{if $verify == 1}
			f = 'captcha';
			l = Dd(f).value;
			if(!is_captcha(l)) {
				Dmsg('请填写验证码', f);
				return false;
			}
			{/if}
			{if $verify == 2}
			f = 'answer';
			if(Dd(f).value == '') {
				Dmsg('请回答验证问题', f);
				return false;
			}
			{/if}
			return true;
		}
		</script>
		{/if}
		<br/><br/><br/>
		{/if}
</div>
</div>
{else}
<div class="m">
	<table cellpadding="0" cellspacing="0" width="100%">
	<tr>
	<td valign="top" class="left_menu">
		<ul>
		<li class="left_menu_li"><a href="{$MODULE[1][linkurl]}">网站首页</a></li>
		<li class="left_menu_li" id="type_0"><a href="{$url}">表单问卷</a></li>
		{loop $_TP[0] $v0}
		<li class="left_menu_li" id="type_{$v0[typeid]}"><a href="{$url}{list_url($v0[typeid])}">{$v0[typename]}</a></li>
			{if isset($_TP[1][$v0[typeid]])}
			{loop $_TP[1][$v0[typeid]] $v1}
			<li class="left_menu_li" id="type_{$v1[typeid]}"><a href="{$url}{list_url($v1[typeid])}">&nbsp;|- {$v1[typename]}</a></li>
			{/loop}
			{/if}
		{/loop}
		</ul>
	</td>
	<td valign="top">
		<div class="left_box">		
			<div class="pos">当前位置: <a href="{$MODULE[1][linkurl]}">首页</a> &raquo; <a href="{$url}">表单问卷</a>{if $typeid} &raquo; <a href="{$url}{list_url($typeid)}">{$TYPE[$typeid][typename]}</a>{/if}</div>
			<div class="b10">&nbsp;</div>
			<table cellpadding="5" cellspacing="5" width="98%" align="center">
			{loop $lists $k $v}
			<tr>
			<td>&middot; {if !$typeid}<a href="{$url}{list_url($v[typeid])}">[{$v[typename]}]</a>&nbsp;{/if}<a href="{$v[linkurl]}">{$v[title]}</a></td>
			<td class="f_gray" width="120">浏览:{$v[hits]}</td>
			<td class="f_gray" width="120" align="center">{$v[adddate]}</td>
			</tr>
			{/loop}
			</table>
			<div class="pages">{$pages}</div>
		<br/>
		</div>
	</td>
	</tr>
	</table>
</div>
<script type="text/javascript">try{Dd('type_{$typeid}').className='left_menu_on';}catch(e){}</script>
{/if}
{template 'footer'}